using HCore.IOC.Context.Event.Attr;
using HCore.IOC.Context.Stereotype;
using HCore.Tests.Runtime.ShootingEditor2D.Scripts.Support.CommandQuery;
using HCore.Tests.Runtime.ShootingEditor2D.Scripts.System.GunSystem;

namespace HCore.Tests.Runtime.ShootingEditor2D.Scripts.Query
{
    /// <summary>
    ///     查询当前枪械弹夹容量
    ///     <para>这个查询是没必要的，仅仅是一个样例而已，这个查询就是一个样例</para>
    /// </summary>
    public class MaxBulletCountQuery : AbstractQuery<int>
    {
    }

    [Component]
    public class MaxBulletCountQueryHandler
    {
        [EventListener]
        public void ExecuteQuery(MaxBulletCountQuery query)
        {
            var gunSystem = HCore.Instance.GetBean<IGunSystem>();
            query.Result = gunSystem.CurrentGunConfigItem.BulletMaxCount;
        }
    }
}